import React from 'react'
import {
    TouchableNativeFeedback,
    Dimensions,
    View,
} from 'react-native'
import { WebView } from 'react-native-webview'


function VideoPlayer(callback?: Function) {
    function getEvent(event: any) {
        const {locationX, locationY} = event.nativeEvent
        if (locationX > 358 && locationX <= 394 && locationY > 268 && locationY <= 290) {
            console.log('no/yew')
            callback && callback()
        }
    }

    return (
        <TouchableNativeFeedback  style={{width: width, height: 300}} onPress={event => getEvent(event)}>
            <View style={{width: width, height: 300}}>
                <WebView
                    javaScriptEnabled={true}
                    mixedContentMode="compatibility"
                    source={{ uri: 'https://ww4.hanjutv.com/index.php?path=https://meiju4.qfxmj.com/20190107/Fk1ma5Dr/index.m3u8&f=ck_m3u8' }}
                />
            </View>
        </TouchableNativeFeedback>

    )
}

const {width} = Dimensions.get('window')

export default VideoPlayer
